namespace designpatternsplusplus.decorator.DecoratorParticipants
{
    #region

    using System;

    #endregion

    /// <summary>
    /// An abstract generic structure for a repository of Key/Values of delegates
    /// </summary>
    /// <typeparam name="TKey">The type of the key.</typeparam>
    /// <typeparam name="TDelegateIn">The type of the delegate in.</typeparam>
    /// <typeparam name="TDelegateOut">The type of the delegate out.</typeparam>
    public abstract class AbstractKeyedDelegate<TKey, TDelegateIn, TDelegateOut>
    {
        readonly Func<TDelegateIn, TDelegateOut> _delegateExec;
        readonly TKey _key;

        protected AbstractKeyedDelegate(TKey KeyValue, Delegate lambadaItemIn)
        {
            _delegateExec = (Func<TDelegateIn, TDelegateOut>) lambadaItemIn;
            _key = KeyValue;
        }

        /// <summary>
        /// Gets the delegate.
        /// </summary>
        /// <value>The delegate exec.</value>
        public Func<TDelegateIn, TDelegateOut> DelegateExec
        {
            get { return _delegateExec; }
        }

        /// <summary>
        /// Gets the key value.
        /// </summary>
        /// <value>The key value.</value>
        public TKey KeyValue
        {
            get { return _key; }
        }
    }
}